package com.MSB.LinkedList;

import java.util.HashMap;
import java.util.Objects;

public class HashMapTest {

    public static class Zuo{
        public int value;
        public Zuo(int v){
            value = v;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Zuo zuo = (Zuo) o;
            return value == zuo.value;
        }

        @Override
        public int hashCode() {
            return Objects.hash(value);
        }
    }

    public static void main(String[] args) {
        HashMap<Zuo, String> map = new HashMap<>();

        Zuo z1 = new Zuo(1);
        Zuo z2 = new Zuo(1);
        map.put(z1, "z1");
        System.out.println(map.containsKey(z2));
    }
}
